package com.yyds.controller;

import com.yyds.common.R;
import com.yyds.pojo.UserUser;
import com.yyds.service.UserUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/common")
public class UserCommonController {

    @Autowired
    private UserUserService userUserService;

    @RequestMapping("/login")
    public R userlogin( String user_name , String user_password){

        UserUser userUser = userUserService.findPasswordByUser(user_name);
        System.out.println("userUser = " + userUser);

        if (null == userUser.getUser_password() && userUser.getUser_password() == "") {
            return R.ok().message("该用户不存在");
        }

        if (!userUser.getUser_password().equals(user_password)){
            return R.ok().message("密码错误");
        }

        return R.ok().message("登录成功");
    }

}


